package exec1;

import java.io.File;
import java.util.Scanner;

public class Test {


    public static void work(String str){
        File file=new File(str);
        if (file.isFile()){
            System.out.println(file.getName());
            return;
        }else if (file.exists()){
            File[] files=file.listFiles();
            for (File f: files){
                System.out.println(f);
                work(f.getName());
            }
        }

    }
    public static  void file(String str){
        File file=new File(str);
        if(file.exists()){
            work(str);
        }else {
            System.out.println("路径不存在");
        }
    }

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入路径");
        file(sc.next());
    }
}


